package com.example.HelloSpace.adapters;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.example.HelloSpace.EncyclopediaFragment;
import com.example.HelloSpace.HomePageFragment;
import com.example.HelloSpace.LaunchTaskFragment;


public class MainViewPagerAdapter extends FragmentStateAdapter {

    public MainViewPagerAdapter(@NonNull FragmentActivity fragmentActivity) {
        super(fragmentActivity);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        switch (position) {
            case 0:
                return new HomePageFragment();
            case 1:
                return new LaunchTaskFragment();
            case 2:
                return new EncyclopediaFragment();
            default:
                return new LaunchTaskFragment();
        }
    }

    @Override
    public int getItemCount() {
        return 5; // Number of fragments
    }
}
